package com.qunduikj.sjb.sdk.model.enums;

/**
 * 路线记录的状态
 * <p/>
 * 1待进行，2进行中，3已完成'
 *
 * @author June @http://litesuits.com
 * @date 2015-08-14
 */
public enum RouteState {
    // 利用构造函数传参
    Standby(0, "待进行"), Underway(1, "进行中"), Completed(2, "已完成");
    // 定义私有变量
    private int code;
    private String recordState;

    // 构造函数，枚举类型只能为私有
    RouteState(int code, String recordState) {
        this.code = code;
        this.recordState = recordState;
    }

    public int getCode() {
        return code;
    }

    public RouteState setCode(int code) {
        this.code = code;
        return this;
    }

    public String getRecordState() {
        return recordState;
    }

    public RouteState setRecordState(String recordState) {
        this.recordState = recordState;
        return this;
    }

    @Override
    public String toString() {
        return "RouteState{" +
                "code=" + code +
                ", recordState='" + recordState + '\'' +
                '}';
    }

    public static String codeGetState(int recordState) {
        RouteState routeStates[] = RouteState.values();
        for (int i = 0; i < routeStates.length; i++) {
            RouteState rs = routeStates[i];
            if (rs.getCode() == recordState) {
                return rs.getRecordState();
            }
        }
        return "";
    }
}
